<template>
  <div class="main">
      
    <div>
      <router-view></router-view>
    </div>

    <van-tabbar v-model="activeIndex" route inactive-color="#646566" active-color="#0C34BA">

      <van-tabbar-item
        v-for="(item, index) in tabbarData"
        :key="index"
        :to="{ name: item.routeName }"
      >
        <span>{{item.title}}</span>
        <template #icon="props">
          <img :src="props.active ? item.activeIcon : item.inactiveIcon" />
        </template>
      </van-tabbar-item>

    </van-tabbar>

  </div>
</template>

<script>
export default {
  name: "Main",
  data() {
    return {
      activeIndex: 0,
      tabbarData: [
        {
          title: "首页",
          activeIcon: require("../assets/home_active.png"),
          inactiveIcon: require("../assets/home.png"),
          routeName: "Home",
        },
        {
          title: "菜单",
          activeIcon: require("../assets/menu_active.png"),
          inactiveIcon: require("../assets/menu.png"),
          routeName: "Menu",
        },
        {
          title: "购物袋",
          activeIcon: require("../assets/shopbag_active.png"),
          inactiveIcon: require("../assets/shopbag.png"),
          routeName: "Shopbag",
        },
        {
          title: "我的",
          activeIcon: require("../assets/my_active.png"),
          inactiveIcon: require("../assets/my.png"),
          routeName: "My",
        },
      ],
    };
  },
};
</script>

<style lang="less" scoped>
</style>